const {
    IncAndExpType
} = require('../../../model/incAndExp/type');

function getdate(times) {
    var now = new Date(times),
        y = now.getFullYear(),
        m = now.getMonth() + 1,
        d = now.getDate();
    return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
}


module.exports = async (req, res) => {
    let data = await IncAndExpType.find().sort('-createTime');
    let list = data.map((item) => {
        return Object.assign({}, { 'id': item._id, 'name': item.name })
    })
    res.send({
        'code': 0, data: list
    });
}